Sequence Diagram for Stack Overflow
Visualize the sequence diagram for closing a question and practice the concepts with a challenge.
We'll cover the following
Sequence diagrams are a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for Stack Overflow. In this lesson, we will create sequence diagrams for the following two interactions:
Close question: A user votes to close a question authored by a different user.
Sequence challenge: A user creates a question and adds a bounty.
Close question#
The sequence diagram for closing a question should have the following actors and objects that will interact with each other:
Actors:
User
andAuthor
Object:
Question
Here are the steps in the close question interaction:
A user votes to close a question with some remark.
If the user is a moderator:
The question is closed.
The author of the question is notified about the question.
Else if they are a regular user:
If the user's reputation is greater than or equal to 3000:
A close vote is added.
If there are 3 close votes, the question closes, and the author is notified.
Else if the user's reputation is less than 3000:
The vote is considered invalid.
Based on the order above, the sequence diagram for closing a question in Stack Overflow is provided below:
Sequence challenge: Create question#
You’ll help us complete a sequence diagram for a new question created by a user where the user adds a bounty to the question. A skeleton of the create question sequence diagram is given below:
Notice that the arrows in the diagram above are numbered from 1 to 8. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of order they should appear in the skeleton of the sequence diagram provided above?
Note: If you get stuck, just click the “Show Solution” button to check out the correct answer.
Alternatively, you can click the "Show complete diagram" button below to see the complete sequence diagram for the create a question interaction.
Next, let's look at the activity diagrams for Stack Overflow to understand the control flow of the system.
Class Diagram for Stack Overflow
Activity Diagram for Stack Overflow